package com.neusoft.neuiotms.micro.auth;

import java.util.Map;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.neusoft.bizcore.auth.common.bean.UserBean;
import com.neusoft.bizcore.web.bean.TreeBean;
import com.neusoft.bizcore.web.dto.result.ResultDTO;
import com.neusoft.bizcore.web.dto.result.ResultListDTO;
import com.neusoft.bizcore.web.support.Searchable;

public interface AuthMicroService {

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/auth/users/username/{username}")
    ResultDTO<UserBean> loadUserByUsername(@PathVariable String username);

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/auth/users")
    ResultListDTO<Map<String, Object>> userIndex(Map<String, Object> search);

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/auth/organizations")
    ResultListDTO<Map<String, Object>> orgIndex();

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/auth/users/batchusers")
    ResultListDTO<Map<String, Object>> batchusers(Map<String, String[]> usernames);

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/auth/users")
    ResultListDTO<Map<String, Object>> allUsers();

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/auth/organizations")
    ResultListDTO<Map<String, Object>> allOrganizations();

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/auth/organizations/tree")
    ResultDTO<TreeBean> organizationTree();

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/auth/roles/code/{code}")
    ResultDTO<Map<String, Object>> roleByCode(@PathVariable String code);

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/auth/organizations/{code}")
    ResultDTO<Map<String, Object>> orgInfoByCode(@PathVariable String code);

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/auth/users")
    ResultListDTO<Map<String, Object>> allUsers(Searchable searchable);
}
